{include file="public/header"/}
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcfcms.css?v={$version}"/>
<script src="{__PUBLIC_PATH}/common/js/jquery.js?v={$version}"></script>
<script src="{__PUBLIC_PATH}/admin/pcf/global.js?v={$version}"></script>
</head>
<body>
<div class="layui-form">
<div class="layui-fluid" style="padding-bottom:83px;border:0;">
<div class="layui-col-sm12">
<div class="layui-card" style="box-shadow:0 0 0 0;">
  <div class="layui-tab layui-tab-brief" id="pcfsystem">
    <ul class="layui-tab-title" style="background-color:#f2f2f2;">
        <a href="{:url('/system.web/index')}"><li>网站设置</li></a>
        <a href="{:url('/system.web/web2')}"><li class="layui-this">核心设置</li></a>
        <a href="{:url('/system.web/basic')}"><li>附件设置</li></a>
        <a href="{:url('/system.web/weapp_email')}"><li>邮箱配置</li></a>
        <a href="{:url('/system.web/weapp_sms')}"><li>短信配置</li></a>
        <a href="{:url('/system.web/weapp_pay')}" style="display:none;"><li>支付配置</li></a>
        <a href="{:url('/system.web/weapp_social')}" style="display:none;"><li>第三方登录配置</li></a>
    </ul>
    <div class="layui-tab-content">

        <div class="layui-form-item none">
          <label class="layui-form-label">系统模式</label>
          <div class="layui-input-inline default-auto">
            <input type="checkbox" lay-filter="web_cmsmode" lay-skin="switch" lay-text="运营模式|开发模式" {if condition="isset($config.web_cmsmode) && $config.web_cmsmode eq 0"}checked{/if}>
            <input type="hidden" name="web_cmsmode" value="{$config.web_cmsmode|default='0'}"/>
          </div>
          <div class="layui-input-inline auto gray">
              开发模式：方便修改模板，及时预览前台效果，没缓存，一改便生效。<br/>
              运营模式：提高前台响应速度，利于收录；改模板及后台发布内容需执行
              【<a style="color:green" id="clear_cache" href="javascript:void(0);">更新缓存</a>】后才能在前台展示。
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">升级弹窗</label>
          <div class="layui-input-inline default-auto">
             <input type="checkbox" lay-filter="web_show_popup_upgrade" lay-skin="switch" lay-text="开启|关闭" {if condition="!isset($config.web_show_popup_upgrade) || $config.web_show_popup_upgrade eq 1"}checked{/if}>
             <input type="hidden" name="web_show_popup_upgrade" value="{$config.web_show_popup_upgrade|default='1'}" />
          </div>
          <div class="layui-input-inline auto gray lh38">
              系统有新版本升级时，后台有弹窗提示
          </div>
        </div>

        <div class="layui-form-item">
          <label class="layui-form-label">开启移动端域名</label>
          <div class="layui-input-inline default-auto">
             <input type="checkbox" lay-filter="web_mobile_domain_open" lay-skin="switch" lay-text="开启|关闭" {if condition="!isset($config.web_mobile_domain_open) || $config.web_mobile_domain_open eq 1"}checked{/if}>
             <input type="hidden" name="web_mobile_domain_open" value="{$config.web_mobile_domain_open|default='1'}" />
          </div>
        </div>

        <div class="layui-form-item" style="margin-bottom:5px;">
          <label class="layui-form-label">移动端域名</label>
          <div class="layui-input-inline default-auto">
              <input type="text" style="width:80px;float:left" name="web_mobile_domain" value="{$config.web_mobile_domain|default='m'}" class="layui-input" lay-verify="required" onKeyUp="this.value=this.value.replace(/[^0-9a-z]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9a-z]/g,''));" placeholder="手机域名">
             <span style="float:left;line-height:38px;margin-left:4px;margin-right:5px;">.{$Request.rootDomain}</span>
          </div>
          <div class="layui-input-inline auto gray lh38">
              请将二级域名 m 解析到站点根目录下
          </div>
        </div>
        <div class="layui-form-item">
           <label class="layui-form-label"></label>
           <div class="layui-input-inline auto gray" style="color:#009688;">手机端访问自动跳转到手机域名下</div>
        </div>
		
		
        <div class="layui-form-item" style="margin-bottom:5px;">
          <label class="layui-form-label">后台路径</label>
          <div class="layui-input-inline">
             <input type="hidden" name="adminbasefile_old" value="{$adminbasefile|default='login'}">
             <span style="float:left;line-height:38px;margin-right:4px;">{$Request.domain}/</span>
             <input style="width: 100px;float: left" type="text" name="adminbasefile" value="{$adminbasefile|default='login'}" lay-verify="required|check_adminbasefile" class="layui-input" onKeyUp="this.value=this.value.replace(/[^0-9a-zA-Z_-]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9a-zA-Z_-]/g,''));">
             <span style="float:left;line-height:38px;margin-left:4px;margin-right:5px;">.php</span>
          </div>
        </div>
        <div class="layui-form-item">
           <label class="layui-form-label"></label>
           <div class="layui-input-inline auto gray" style="color:#009688;">为了提高后台的安全性，请及时更改后台入口文件。</div>
        </div>
		
        <div class="layui-form-item" style="margin-bottom:5px;">
            <label class="layui-form-label">后台LOGO</label>
            <div class="layui-input-inline default-auto">
            <ul class="layout">
              <li>
              <input name="web_adminlogo" id="web_adminlogo" placeholder="图片地址" value="{$config.web_adminlogo|default=''}" class="layui-input">
              <input type="hidden" name="old_web_adminlogo" value="{$config.web_adminlogo|default=''}">
              <img id="img_web_adminlogo" src="{$config.web_adminlogo|get_default_pic=###}?v={php}echo time();{/php}" class="pcfdisplay">
              </li>
              <li style="margin-top:3px;">
                <div class="layui-btn-group">
                  <input type="button" value="上传图片" class="layui-btn layui-btn-sm test-upload-demoMore" lay-data="{number:1,ey_inputId:'web_adminlogo',ey_savepath:'allimg'}">
                  <input type="button" value="选择图片" class="layui-btn layui-btn-sm" onClick="GetPictureFolder(1,'web_adminlogo');">
                  <input type="button" value="预览" class="layui-btn layui-btn-sm" onclick="BigImages($('#img_web_adminlogo').attr('src'));">
                  <input type="button" value="清除" class="layui-btn layui-btn-sm layui-btn-warm" data-inputid="web_adminlogo" onclick="DelImages(this);">
                </div>
              </li>
            </ul>
          </div>
        </div>
        <div class="layui-form-item">
           <label class="layui-form-label"></label>
           <div class="layui-input-inline auto gray" style="color:#009688;">默认网站LOGO，通用头部显示，显示尺寸以模板设计为主</div>
        </div>
		
        <div class="layui-form-item" style="margin-bottom:5px;display:none;">
          <label class="layui-form-label">使用https</label>
          <div class="layui-input-inline default-auto">
            <input type="checkbox" lay-filter="web_is_https" lay-skin="switch" lay-text="开启|关闭" {if condition="isset($config.web_is_https) && $config.web_is_https eq 1"} checked{/if}>
             <input type="hidden" name="web_is_https" value="{$config.web_is_https|default='0'}"/>
          </div>
          <div class="layui-input-inline auto gray">
              开启前，请先在空间正确配置SSL证书。<br/>在能正常访问https://域名的情况下，才开启这个功能，使整站的URL都强制采用https协议访问。
          </div>
        </div>
        <div class="layui-form-item" style="display:none;">
           <label class="layui-form-label"></label>
           <div class="layui-input-inline auto gray" style="color:#009688;">开启之后，sitemap.xml地图以及全站URL将带有https头协议</div>
        </div>
		
        <div class="layui-form-item" style="margin-bottom:5px;">
          <label class="layui-form-label">安装目录</label>
          <div class="layui-input-inline">
            <input type="text" name="web_cmspath" value="{$config.web_cmspath|default=''}" class="layui-input">
          </div>
        </div>
        <div class="layui-form-item">
           <label class="layui-form-label"></label>
           <div class="layui-input-inline auto gray" style="color:#009688;">目录后面不要带 / 反斜杆，一般适用于CMS安装在子目录</div>
        </div>
		
		
        <div class="layui-form-item">
          <label class="layui-form-label">数据备份目录</label>
          <div class="layui-input-inline">
              <input type="text" name="web_sqldatapath" value="{$config.web_sqldatapath|default=$sqlbackuppath}" class="layui-input">
          </div>
        </div>
    </div>
  </div>
</div>
</div>
<div class="submit-info text-center">
    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
</div>
<div class="pcfclear"></div>
</div>
</div>
{include file="public/footer"/}
<script type="text/javascript">
    layui.use(['layer', 'form', 'element', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var element = layui.element;
        var admin = layui.admin;
        form.verify({
          check_adminbasefile: function(value, item){
            if(/[^0-9a-zA-Z_-]/.test(value)){return '只允许字母、数字、下划线和连接符等组合！';}
          }
        });
        //清除缓存
        $('#clear_cache').click(function(){
            layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
            $.ajax({
                type : 'post',
                url : "{:url('/index/clearCache')}",
                dataType : 'json',
                success : function(res){
                    layer.closeAll('loading');
                    if(res.status ==1){
                        layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                            window.location.reload();
                        });
                    }else{
                        layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                },
                error: function(e){
                    layer.closeAll('loading');
                    layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                }
            });
        });
        //监听提交
        form.on('submit(formSubmit)', function(data){
            if(data.field.adminbasefile_old != data.field.adminbasefile){
                var flag = false;
                layer.confirm('后台路径：<font color="red">'+'{$Request.domain}'+'/'+data.field.adminbasefile+'.php</font>，确认更改？', {
                        title: false,
                        btn: ['继续更改','取消']//按钮
                    }, function(index){
                        layer.close(index);
                        formSubmit(data);
                    }, function(index){
                        flag = false;
                    }
                );
                return flag;
            }
            formSubmit(data);
            function formSubmit(data){
                layer.msg('正在处理请勿刷新页面', {icon: 16,shade: 0.01,time:3600000});
                $.ajax({
                    type : 'post',
                    url : "{:url('/system.web/web2')}",
                    data : data.field,
                    dataType : 'json',
                    success : function(res){
                        layer.closeAll('loading');
                        if(res.status){
                            layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                                if ('_parent' == res.target) {
                                    top.window.location.href = res.url;
                                    admin.strToWin($(this).data('window')).layui.admin.closeAllTabs();
                                } else {
                                    window.location.reload();
                                }
                            });
                        }else{
                            layer.msg(res.msg, {icon: 2, time: 1000});
                        }
                    },
                    error: function(e){
                        layer.closeAll('loading');
                        layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                    }
                });
                return false;
            }
        });
        //监听开关
        form.on('switch', function(data){
          var elemId = data.elem.attributes['lay-filter']['nodeValue'];
          if (data.elem.checked) {
            this.value = 1;
          } else {
            this.value = 0;
          }
          $("input[name='"+elemId+"']").val(this.value);
        })
  });
</script>
</body>
</html>